package torque.generated;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.map.TableMap;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;





/**
 * Objet Table
 *
 * This class was autogenerated by Torque on:
 *
 * [Thu Oct 17 18:54:08 CEST 2013]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Objet
 */
public abstract class BaseObjet extends BaseObject
{
    /** Serial version */
    private static final long serialVersionUID = 1382028848659L;

    /** The Peer class */
    private static final ObjetPeer peer =
        new ObjetPeer();


    /** The value for the nomobjet field */
    private String nomobjet;

    /** The value for the descriptionobjet field */
    private String descriptionobjet;

    /** The value for the attaquebonus field */
    private int attaquebonus;

    /** The value for the degatsbonus field */
    private int degatsbonus;

    /** The value for the esquivebonus field */
    private int esquivebonus;

    /** The value for the pointdeviebonus field */
    private int pointdeviebonus;


    /**
     * Get the Nomobjet
     *
     * @return String
     */
    public String getNomobjet()
    {
        return nomobjet;
    }


    /**
     * Set the value of Nomobjet
     *
     * @param v new value
     */
    public void setNomobjet(String v) throws TorqueException
    {

        if (!ObjectUtils.equals(this.nomobjet, v))
        {
            this.nomobjet = v;
            setModified(true);
        }



        // update associated Equipement
        if (collEquipements != null)
        {
            for (int i = 0; i < collEquipements.size(); i++)
            {
                ((Equipement) collEquipements.get(i))
                        .setNomobjet(v);
            }
        }

        // update associated Potion
        if (collPotions != null)
        {
            for (int i = 0; i < collPotions.size(); i++)
            {
                ((Potion) collPotions.get(i))
                        .setNomobjet(v);
            }
        }

        // update associated Inventaireequipement
        if (collInventaireequipements != null)
        {
            for (int i = 0; i < collInventaireequipements.size(); i++)
            {
                ((Inventaireequipement) collInventaireequipements.get(i))
                        .setNomobjet(v);
            }
        }

        // update associated Inventairepotion
        if (collInventairepotions != null)
        {
            for (int i = 0; i < collInventairepotions.size(); i++)
            {
                ((Inventairepotion) collInventairepotions.get(i))
                        .setNomobjet(v);
            }
        }

        // update associated Objetpartie
        if (collObjetparties != null)
        {
            for (int i = 0; i < collObjetparties.size(); i++)
            {
                ((Objetpartie) collObjetparties.get(i))
                        .setNomobjet(v);
            }
        }
    }

    /**
     * Get the Descriptionobjet
     *
     * @return String
     */
    public String getDescriptionobjet()
    {
        return descriptionobjet;
    }


    /**
     * Set the value of Descriptionobjet
     *
     * @param v new value
     */
    public void setDescriptionobjet(String v) 
    {

        if (!ObjectUtils.equals(this.descriptionobjet, v))
        {
            this.descriptionobjet = v;
            setModified(true);
        }


    }

    /**
     * Get the Attaquebonus
     *
     * @return int
     */
    public int getAttaquebonus()
    {
        return attaquebonus;
    }


    /**
     * Set the value of Attaquebonus
     *
     * @param v new value
     */
    public void setAttaquebonus(int v) 
    {

        if (this.attaquebonus != v)
        {
            this.attaquebonus = v;
            setModified(true);
        }


    }

    /**
     * Get the Degatsbonus
     *
     * @return int
     */
    public int getDegatsbonus()
    {
        return degatsbonus;
    }


    /**
     * Set the value of Degatsbonus
     *
     * @param v new value
     */
    public void setDegatsbonus(int v) 
    {

        if (this.degatsbonus != v)
        {
            this.degatsbonus = v;
            setModified(true);
        }


    }

    /**
     * Get the Esquivebonus
     *
     * @return int
     */
    public int getEsquivebonus()
    {
        return esquivebonus;
    }


    /**
     * Set the value of Esquivebonus
     *
     * @param v new value
     */
    public void setEsquivebonus(int v) 
    {

        if (this.esquivebonus != v)
        {
            this.esquivebonus = v;
            setModified(true);
        }


    }

    /**
     * Get the Pointdeviebonus
     *
     * @return int
     */
    public int getPointdeviebonus()
    {
        return pointdeviebonus;
    }


    /**
     * Set the value of Pointdeviebonus
     *
     * @param v new value
     */
    public void setPointdeviebonus(int v) 
    {

        if (this.pointdeviebonus != v)
        {
            this.pointdeviebonus = v;
            setModified(true);
        }


    }

       


    /**
     * Collection to store aggregation of collEquipements
     */
    protected List collEquipements;

    /**
     * Temporary storage of collEquipements to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initEquipements()
    {
        if (collEquipements == null)
        {
            collEquipements = new ArrayList();
        }
    }


    /**
     * Method called to associate a Equipement object to this object
     * through the Equipement foreign key attribute
     *
     * @param l Equipement
     * @throws TorqueException
     */
    public void addEquipement(Equipement l) throws TorqueException
    {
        getEquipements().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Equipement object to this object
     * through the Equipement foreign key attribute using connection.
     *
     * @param l Equipement
     * @throws TorqueException
     */
    public void addEquipement(Equipement l, Connection con) throws TorqueException
    {
        getEquipements(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collEquipements
     */
    private Criteria lastEquipementsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getEquipements(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getEquipements()
        throws TorqueException
    {
        if (collEquipements == null)
        {
            collEquipements = getEquipements(new Criteria(10));
        }
        return collEquipements;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Equipements from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getEquipements(Criteria criteria) throws TorqueException
    {
        if (collEquipements == null)
        {
            if (isNew())
            {
               collEquipements = new ArrayList();
            }
            else
            {
                criteria.add(EquipementPeer.NOMOBJET, getNomobjet() );
                collEquipements = EquipementPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(EquipementPeer.NOMOBJET, getNomobjet());
                if (!lastEquipementsCriteria.equals(criteria))
                {
                    collEquipements = EquipementPeer.doSelect(criteria);
                }
            }
        }
        lastEquipementsCriteria = criteria;

        return collEquipements;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getEquipements(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getEquipements(Connection con) throws TorqueException
    {
        if (collEquipements == null)
        {
            collEquipements = getEquipements(new Criteria(10), con);
        }
        return collEquipements;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Equipements from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getEquipements(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collEquipements == null)
        {
            if (isNew())
            {
               collEquipements = new ArrayList();
            }
            else
            {
                 criteria.add(EquipementPeer.NOMOBJET, getNomobjet());
                 collEquipements = EquipementPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(EquipementPeer.NOMOBJET, getNomobjet());
                 if (!lastEquipementsCriteria.equals(criteria))
                 {
                     collEquipements = EquipementPeer.doSelect(criteria, con);
                 }
             }
         }
         lastEquipementsCriteria = criteria;

         return collEquipements;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Equipements from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getEquipementsJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collEquipements == null)
        {
            if (isNew())
            {
               collEquipements = new ArrayList();
            }
            else
            {
                criteria.add(EquipementPeer.NOMOBJET, getNomobjet());
                collEquipements = EquipementPeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(EquipementPeer.NOMOBJET, getNomobjet());
            if (!lastEquipementsCriteria.equals(criteria))
            {
                collEquipements = EquipementPeer.doSelectJoinObjet(criteria);
            }
        }
        lastEquipementsCriteria = criteria;

        return collEquipements;
    }





    /**
     * Collection to store aggregation of collPotions
     */
    protected List collPotions;

    /**
     * Temporary storage of collPotions to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initPotions()
    {
        if (collPotions == null)
        {
            collPotions = new ArrayList();
        }
    }


    /**
     * Method called to associate a Potion object to this object
     * through the Potion foreign key attribute
     *
     * @param l Potion
     * @throws TorqueException
     */
    public void addPotion(Potion l) throws TorqueException
    {
        getPotions().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Potion object to this object
     * through the Potion foreign key attribute using connection.
     *
     * @param l Potion
     * @throws TorqueException
     */
    public void addPotion(Potion l, Connection con) throws TorqueException
    {
        getPotions(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collPotions
     */
    private Criteria lastPotionsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getPotions(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getPotions()
        throws TorqueException
    {
        if (collPotions == null)
        {
            collPotions = getPotions(new Criteria(10));
        }
        return collPotions;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Potions from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getPotions(Criteria criteria) throws TorqueException
    {
        if (collPotions == null)
        {
            if (isNew())
            {
               collPotions = new ArrayList();
            }
            else
            {
                criteria.add(PotionPeer.NOMOBJET, getNomobjet() );
                collPotions = PotionPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(PotionPeer.NOMOBJET, getNomobjet());
                if (!lastPotionsCriteria.equals(criteria))
                {
                    collPotions = PotionPeer.doSelect(criteria);
                }
            }
        }
        lastPotionsCriteria = criteria;

        return collPotions;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getPotions(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getPotions(Connection con) throws TorqueException
    {
        if (collPotions == null)
        {
            collPotions = getPotions(new Criteria(10), con);
        }
        return collPotions;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Potions from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getPotions(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collPotions == null)
        {
            if (isNew())
            {
               collPotions = new ArrayList();
            }
            else
            {
                 criteria.add(PotionPeer.NOMOBJET, getNomobjet());
                 collPotions = PotionPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(PotionPeer.NOMOBJET, getNomobjet());
                 if (!lastPotionsCriteria.equals(criteria))
                 {
                     collPotions = PotionPeer.doSelect(criteria, con);
                 }
             }
         }
         lastPotionsCriteria = criteria;

         return collPotions;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Potions from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getPotionsJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collPotions == null)
        {
            if (isNew())
            {
               collPotions = new ArrayList();
            }
            else
            {
                criteria.add(PotionPeer.NOMOBJET, getNomobjet());
                collPotions = PotionPeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(PotionPeer.NOMOBJET, getNomobjet());
            if (!lastPotionsCriteria.equals(criteria))
            {
                collPotions = PotionPeer.doSelectJoinObjet(criteria);
            }
        }
        lastPotionsCriteria = criteria;

        return collPotions;
    }





    /**
     * Collection to store aggregation of collInventaireequipements
     */
    protected List collInventaireequipements;

    /**
     * Temporary storage of collInventaireequipements to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initInventaireequipements()
    {
        if (collInventaireequipements == null)
        {
            collInventaireequipements = new ArrayList();
        }
    }


    /**
     * Method called to associate a Inventaireequipement object to this object
     * through the Inventaireequipement foreign key attribute
     *
     * @param l Inventaireequipement
     * @throws TorqueException
     */
    public void addInventaireequipement(Inventaireequipement l) throws TorqueException
    {
        getInventaireequipements().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Inventaireequipement object to this object
     * through the Inventaireequipement foreign key attribute using connection.
     *
     * @param l Inventaireequipement
     * @throws TorqueException
     */
    public void addInventaireequipement(Inventaireequipement l, Connection con) throws TorqueException
    {
        getInventaireequipements(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collInventaireequipements
     */
    private Criteria lastInventaireequipementsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getInventaireequipements(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getInventaireequipements()
        throws TorqueException
    {
        if (collInventaireequipements == null)
        {
            collInventaireequipements = getInventaireequipements(new Criteria(10));
        }
        return collInventaireequipements;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Inventaireequipements from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getInventaireequipements(Criteria criteria) throws TorqueException
    {
        if (collInventaireequipements == null)
        {
            if (isNew())
            {
               collInventaireequipements = new ArrayList();
            }
            else
            {
                criteria.add(InventaireequipementPeer.NOMOBJET, getNomobjet() );
                collInventaireequipements = InventaireequipementPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(InventaireequipementPeer.NOMOBJET, getNomobjet());
                if (!lastInventaireequipementsCriteria.equals(criteria))
                {
                    collInventaireequipements = InventaireequipementPeer.doSelect(criteria);
                }
            }
        }
        lastInventaireequipementsCriteria = criteria;

        return collInventaireequipements;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getInventaireequipements(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getInventaireequipements(Connection con) throws TorqueException
    {
        if (collInventaireequipements == null)
        {
            collInventaireequipements = getInventaireequipements(new Criteria(10), con);
        }
        return collInventaireequipements;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Inventaireequipements from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getInventaireequipements(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collInventaireequipements == null)
        {
            if (isNew())
            {
               collInventaireequipements = new ArrayList();
            }
            else
            {
                 criteria.add(InventaireequipementPeer.NOMOBJET, getNomobjet());
                 collInventaireequipements = InventaireequipementPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(InventaireequipementPeer.NOMOBJET, getNomobjet());
                 if (!lastInventaireequipementsCriteria.equals(criteria))
                 {
                     collInventaireequipements = InventaireequipementPeer.doSelect(criteria, con);
                 }
             }
         }
         lastInventaireequipementsCriteria = criteria;

         return collInventaireequipements;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Inventaireequipements from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getInventaireequipementsJoinTroll(Criteria criteria)
        throws TorqueException
    {
        if (collInventaireequipements == null)
        {
            if (isNew())
            {
               collInventaireequipements = new ArrayList();
            }
            else
            {
                criteria.add(InventaireequipementPeer.NOMOBJET, getNomobjet());
                collInventaireequipements = InventaireequipementPeer.doSelectJoinTroll(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(InventaireequipementPeer.NOMOBJET, getNomobjet());
            if (!lastInventaireequipementsCriteria.equals(criteria))
            {
                collInventaireequipements = InventaireequipementPeer.doSelectJoinTroll(criteria);
            }
        }
        lastInventaireequipementsCriteria = criteria;

        return collInventaireequipements;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Inventaireequipements from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getInventaireequipementsJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collInventaireequipements == null)
        {
            if (isNew())
            {
               collInventaireequipements = new ArrayList();
            }
            else
            {
                criteria.add(InventaireequipementPeer.NOMOBJET, getNomobjet());
                collInventaireequipements = InventaireequipementPeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(InventaireequipementPeer.NOMOBJET, getNomobjet());
            if (!lastInventaireequipementsCriteria.equals(criteria))
            {
                collInventaireequipements = InventaireequipementPeer.doSelectJoinObjet(criteria);
            }
        }
        lastInventaireequipementsCriteria = criteria;

        return collInventaireequipements;
    }





    /**
     * Collection to store aggregation of collInventairepotions
     */
    protected List collInventairepotions;

    /**
     * Temporary storage of collInventairepotions to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initInventairepotions()
    {
        if (collInventairepotions == null)
        {
            collInventairepotions = new ArrayList();
        }
    }


    /**
     * Method called to associate a Inventairepotion object to this object
     * through the Inventairepotion foreign key attribute
     *
     * @param l Inventairepotion
     * @throws TorqueException
     */
    public void addInventairepotion(Inventairepotion l) throws TorqueException
    {
        getInventairepotions().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Inventairepotion object to this object
     * through the Inventairepotion foreign key attribute using connection.
     *
     * @param l Inventairepotion
     * @throws TorqueException
     */
    public void addInventairepotion(Inventairepotion l, Connection con) throws TorqueException
    {
        getInventairepotions(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collInventairepotions
     */
    private Criteria lastInventairepotionsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getInventairepotions(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getInventairepotions()
        throws TorqueException
    {
        if (collInventairepotions == null)
        {
            collInventairepotions = getInventairepotions(new Criteria(10));
        }
        return collInventairepotions;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Inventairepotions from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getInventairepotions(Criteria criteria) throws TorqueException
    {
        if (collInventairepotions == null)
        {
            if (isNew())
            {
               collInventairepotions = new ArrayList();
            }
            else
            {
                criteria.add(InventairepotionPeer.NOMOBJET, getNomobjet() );
                collInventairepotions = InventairepotionPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(InventairepotionPeer.NOMOBJET, getNomobjet());
                if (!lastInventairepotionsCriteria.equals(criteria))
                {
                    collInventairepotions = InventairepotionPeer.doSelect(criteria);
                }
            }
        }
        lastInventairepotionsCriteria = criteria;

        return collInventairepotions;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getInventairepotions(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getInventairepotions(Connection con) throws TorqueException
    {
        if (collInventairepotions == null)
        {
            collInventairepotions = getInventairepotions(new Criteria(10), con);
        }
        return collInventairepotions;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Inventairepotions from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getInventairepotions(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collInventairepotions == null)
        {
            if (isNew())
            {
               collInventairepotions = new ArrayList();
            }
            else
            {
                 criteria.add(InventairepotionPeer.NOMOBJET, getNomobjet());
                 collInventairepotions = InventairepotionPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(InventairepotionPeer.NOMOBJET, getNomobjet());
                 if (!lastInventairepotionsCriteria.equals(criteria))
                 {
                     collInventairepotions = InventairepotionPeer.doSelect(criteria, con);
                 }
             }
         }
         lastInventairepotionsCriteria = criteria;

         return collInventairepotions;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Inventairepotions from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getInventairepotionsJoinTroll(Criteria criteria)
        throws TorqueException
    {
        if (collInventairepotions == null)
        {
            if (isNew())
            {
               collInventairepotions = new ArrayList();
            }
            else
            {
                criteria.add(InventairepotionPeer.NOMOBJET, getNomobjet());
                collInventairepotions = InventairepotionPeer.doSelectJoinTroll(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(InventairepotionPeer.NOMOBJET, getNomobjet());
            if (!lastInventairepotionsCriteria.equals(criteria))
            {
                collInventairepotions = InventairepotionPeer.doSelectJoinTroll(criteria);
            }
        }
        lastInventairepotionsCriteria = criteria;

        return collInventairepotions;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Inventairepotions from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getInventairepotionsJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collInventairepotions == null)
        {
            if (isNew())
            {
               collInventairepotions = new ArrayList();
            }
            else
            {
                criteria.add(InventairepotionPeer.NOMOBJET, getNomobjet());
                collInventairepotions = InventairepotionPeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(InventairepotionPeer.NOMOBJET, getNomobjet());
            if (!lastInventairepotionsCriteria.equals(criteria))
            {
                collInventairepotions = InventairepotionPeer.doSelectJoinObjet(criteria);
            }
        }
        lastInventairepotionsCriteria = criteria;

        return collInventairepotions;
    }





    /**
     * Collection to store aggregation of collObjetparties
     */
    protected List collObjetparties;

    /**
     * Temporary storage of collObjetparties to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initObjetparties()
    {
        if (collObjetparties == null)
        {
            collObjetparties = new ArrayList();
        }
    }


    /**
     * Method called to associate a Objetpartie object to this object
     * through the Objetpartie foreign key attribute
     *
     * @param l Objetpartie
     * @throws TorqueException
     */
    public void addObjetpartie(Objetpartie l) throws TorqueException
    {
        getObjetparties().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Objetpartie object to this object
     * through the Objetpartie foreign key attribute using connection.
     *
     * @param l Objetpartie
     * @throws TorqueException
     */
    public void addObjetpartie(Objetpartie l, Connection con) throws TorqueException
    {
        getObjetparties(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collObjetparties
     */
    private Criteria lastObjetpartiesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getObjetparties(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getObjetparties()
        throws TorqueException
    {
        if (collObjetparties == null)
        {
            collObjetparties = getObjetparties(new Criteria(10));
        }
        return collObjetparties;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Objetparties from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getObjetparties(Criteria criteria) throws TorqueException
    {
        if (collObjetparties == null)
        {
            if (isNew())
            {
               collObjetparties = new ArrayList();
            }
            else
            {
                criteria.add(ObjetpartiePeer.NOMOBJET, getNomobjet() );
                collObjetparties = ObjetpartiePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(ObjetpartiePeer.NOMOBJET, getNomobjet());
                if (!lastObjetpartiesCriteria.equals(criteria))
                {
                    collObjetparties = ObjetpartiePeer.doSelect(criteria);
                }
            }
        }
        lastObjetpartiesCriteria = criteria;

        return collObjetparties;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getObjetparties(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getObjetparties(Connection con) throws TorqueException
    {
        if (collObjetparties == null)
        {
            collObjetparties = getObjetparties(new Criteria(10), con);
        }
        return collObjetparties;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Objetparties from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getObjetparties(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collObjetparties == null)
        {
            if (isNew())
            {
               collObjetparties = new ArrayList();
            }
            else
            {
                 criteria.add(ObjetpartiePeer.NOMOBJET, getNomobjet());
                 collObjetparties = ObjetpartiePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(ObjetpartiePeer.NOMOBJET, getNomobjet());
                 if (!lastObjetpartiesCriteria.equals(criteria))
                 {
                     collObjetparties = ObjetpartiePeer.doSelect(criteria, con);
                 }
             }
         }
         lastObjetpartiesCriteria = criteria;

         return collObjetparties;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Objetparties from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getObjetpartiesJoinEchiquier(Criteria criteria)
        throws TorqueException
    {
        if (collObjetparties == null)
        {
            if (isNew())
            {
               collObjetparties = new ArrayList();
            }
            else
            {
                criteria.add(ObjetpartiePeer.NOMOBJET, getNomobjet());
                collObjetparties = ObjetpartiePeer.doSelectJoinEchiquier(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(ObjetpartiePeer.NOMOBJET, getNomobjet());
            if (!lastObjetpartiesCriteria.equals(criteria))
            {
                collObjetparties = ObjetpartiePeer.doSelectJoinEchiquier(criteria);
            }
        }
        lastObjetpartiesCriteria = criteria;

        return collObjetparties;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Objetparties from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getObjetpartiesJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collObjetparties == null)
        {
            if (isNew())
            {
               collObjetparties = new ArrayList();
            }
            else
            {
                criteria.add(ObjetpartiePeer.NOMOBJET, getNomobjet());
                collObjetparties = ObjetpartiePeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(ObjetpartiePeer.NOMOBJET, getNomobjet());
            if (!lastObjetpartiesCriteria.equals(criteria))
            {
                collObjetparties = ObjetpartiePeer.doSelectJoinObjet(criteria);
            }
        }
        lastObjetpartiesCriteria = criteria;

        return collObjetparties;
    }



        
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
            fieldNames.add("Nomobjet");
            fieldNames.add("Descriptionobjet");
            fieldNames.add("Attaquebonus");
            fieldNames.add("Degatsbonus");
            fieldNames.add("Esquivebonus");
            fieldNames.add("Pointdeviebonus");
            fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by field (Java) name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
        if (name.equals("Nomobjet"))
        {
            return getNomobjet();
        }
        if (name.equals("Descriptionobjet"))
        {
            return getDescriptionobjet();
        }
        if (name.equals("Attaquebonus"))
        {
            return new Integer(getAttaquebonus());
        }
        if (name.equals("Degatsbonus"))
        {
            return new Integer(getDegatsbonus());
        }
        if (name.equals("Esquivebonus"))
        {
            return new Integer(getEsquivebonus());
        }
        if (name.equals("Pointdeviebonus"))
        {
            return new Integer(getPointdeviebonus());
        }
        return null;
    }

    /**
     * Set a field in the object by field (Java) name.
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByName(String name, Object value )
        throws TorqueException, IllegalArgumentException
    {
        if (name.equals("Nomobjet"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setNomobjet((String) value);
            return true;
        }
        if (name.equals("Descriptionobjet"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setDescriptionobjet((String) value);
            return true;
        }
        if (name.equals("Attaquebonus"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setAttaquebonus(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Degatsbonus"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setDegatsbonus(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Esquivebonus"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setEsquivebonus(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Pointdeviebonus"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setPointdeviebonus(((Integer) value).intValue());
            return true;
        }
        return false;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
        if (name.equals(ObjetPeer.NOMOBJET))
        {
            return getNomobjet();
        }
        if (name.equals(ObjetPeer.DESCRIPTIONOBJET))
        {
            return getDescriptionobjet();
        }
        if (name.equals(ObjetPeer.ATTAQUEBONUS))
        {
            return new Integer(getAttaquebonus());
        }
        if (name.equals(ObjetPeer.DEGATSBONUS))
        {
            return new Integer(getDegatsbonus());
        }
        if (name.equals(ObjetPeer.ESQUIVEBONUS))
        {
            return new Integer(getEsquivebonus());
        }
        if (name.equals(ObjetPeer.POINTDEVIEBONUS))
        {
            return new Integer(getPointdeviebonus());
        }
        return null;
    }

    /**
     * Set field values by Peer Field Name
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPeerName(String name, Object value)
        throws TorqueException, IllegalArgumentException
    {
      if (ObjetPeer.NOMOBJET.equals(name))
        {
            return setByName("Nomobjet", value);
        }
      if (ObjetPeer.DESCRIPTIONOBJET.equals(name))
        {
            return setByName("Descriptionobjet", value);
        }
      if (ObjetPeer.ATTAQUEBONUS.equals(name))
        {
            return setByName("Attaquebonus", value);
        }
      if (ObjetPeer.DEGATSBONUS.equals(name))
        {
            return setByName("Degatsbonus", value);
        }
      if (ObjetPeer.ESQUIVEBONUS.equals(name))
        {
            return setByName("Esquivebonus", value);
        }
      if (ObjetPeer.POINTDEVIEBONUS.equals(name))
        {
            return setByName("Pointdeviebonus", value);
        }
        return false;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
        if (pos == 0)
        {
            return getNomobjet();
        }
        if (pos == 1)
        {
            return getDescriptionobjet();
        }
        if (pos == 2)
        {
            return new Integer(getAttaquebonus());
        }
        if (pos == 3)
        {
            return new Integer(getDegatsbonus());
        }
        if (pos == 4)
        {
            return new Integer(getEsquivebonus());
        }
        if (pos == 5)
        {
            return new Integer(getPointdeviebonus());
        }
        return null;
    }

    /**
     * Set field values by its position (zero based) in the XML schema.
     *
     * @param position The field position
     * @param value field value
     * @return True if value was set, false if not (invalid position / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPosition(int position, Object value)
        throws TorqueException, IllegalArgumentException
    {
    if (position == 0)
        {
            return setByName("Nomobjet", value);
        }
    if (position == 1)
        {
            return setByName("Descriptionobjet", value);
        }
    if (position == 2)
        {
            return setByName("Attaquebonus", value);
        }
    if (position == 3)
        {
            return setByName("Degatsbonus", value);
        }
    if (position == 4)
        {
            return setByName("Esquivebonus", value);
        }
    if (position == 5)
        {
            return setByName("Pointdeviebonus", value);
        }
        return false;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
        save(ObjetPeer.DATABASE_NAME);
    }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
     *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
        try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
    }

    /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
        if (!alreadyInSave)
        {
            alreadyInSave = true;



            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    ObjetPeer.doInsert((Objet) this, con);
                    setNew(false);
                }
                else
                {
                    ObjetPeer.doUpdate((Objet) this, con);
                }
            }


            if (collEquipements != null)
            {
                for (int i = 0; i < collEquipements.size(); i++)
                {
                    ((Equipement) collEquipements.get(i)).save(con);
                }
            }

            if (collPotions != null)
            {
                for (int i = 0; i < collPotions.size(); i++)
                {
                    ((Potion) collPotions.get(i)).save(con);
                }
            }

            if (collInventaireequipements != null)
            {
                for (int i = 0; i < collInventaireequipements.size(); i++)
                {
                    ((Inventaireequipement) collInventaireequipements.get(i)).save(con);
                }
            }

            if (collInventairepotions != null)
            {
                for (int i = 0; i < collInventairepotions.size(); i++)
                {
                    ((Inventairepotion) collInventairepotions.get(i)).save(con);
                }
            }

            if (collObjetparties != null)
            {
                for (int i = 0; i < collObjetparties.size(); i++)
                {
                    ((Objetpartie) collObjetparties.get(i)).save(con);
                }
            }
            alreadyInSave = false;
        }
    }


    /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param key nomobjet ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
        setNomobjet(key.toString());
    }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
        setNomobjet(key);
    }


    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
        return SimpleKey.keyFor(getNomobjet());
    }
 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     */
    public Objet copy() throws TorqueException
    {
        return copy(true);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     *
     * @param con the database connection to read associated objects.
     */
    public Objet copy(Connection con) throws TorqueException
    {
        return copy(true, con);
    }

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     */
    public Objet copy(boolean deepcopy) throws TorqueException
    {
        return copyInto(new Objet(), deepcopy);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     * @param con the database connection to read associated objects.
     */
    public Objet copy(boolean deepcopy, Connection con) throws TorqueException
    {
        return copyInto(new Objet(), deepcopy, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     */
    protected Objet copyInto(Objet copyObj) throws TorqueException
    {
        return copyInto(copyObj, true);
    }

  
    /**
     * Fills the copyObj with the contents of this object using connection.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param con the database connection to read associated objects.
     */
    protected Objet copyInto(Objet copyObj, Connection con) throws TorqueException
    {
        return copyInto(copyObj, true, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     */
    protected Objet copyInto(Objet copyObj, boolean deepcopy) throws TorqueException
    {
        copyObj.setNomobjet(nomobjet);
        copyObj.setDescriptionobjet(descriptionobjet);
        copyObj.setAttaquebonus(attaquebonus);
        copyObj.setDegatsbonus(degatsbonus);
        copyObj.setEsquivebonus(esquivebonus);
        copyObj.setPointdeviebonus(pointdeviebonus);

        copyObj.setNomobjet((String)null);

        if (deepcopy)
        {


        List vEquipements = getEquipements();
        if (vEquipements != null)
        {
            for (int i = 0; i < vEquipements.size(); i++)
            {
                Equipement obj = (Equipement) vEquipements.get(i);
                copyObj.addEquipement(obj.copy());
            }
        }
        else
        {
            copyObj.collEquipements = null;
        }


        List vPotions = getPotions();
        if (vPotions != null)
        {
            for (int i = 0; i < vPotions.size(); i++)
            {
                Potion obj = (Potion) vPotions.get(i);
                copyObj.addPotion(obj.copy());
            }
        }
        else
        {
            copyObj.collPotions = null;
        }


        List vInventaireequipements = getInventaireequipements();
        if (vInventaireequipements != null)
        {
            for (int i = 0; i < vInventaireequipements.size(); i++)
            {
                Inventaireequipement obj = (Inventaireequipement) vInventaireequipements.get(i);
                copyObj.addInventaireequipement(obj.copy());
            }
        }
        else
        {
            copyObj.collInventaireequipements = null;
        }


        List vInventairepotions = getInventairepotions();
        if (vInventairepotions != null)
        {
            for (int i = 0; i < vInventairepotions.size(); i++)
            {
                Inventairepotion obj = (Inventairepotion) vInventairepotions.get(i);
                copyObj.addInventairepotion(obj.copy());
            }
        }
        else
        {
            copyObj.collInventairepotions = null;
        }


        List vObjetparties = getObjetparties();
        if (vObjetparties != null)
        {
            for (int i = 0; i < vObjetparties.size(); i++)
            {
                Objetpartie obj = (Objetpartie) vObjetparties.get(i);
                copyObj.addObjetpartie(obj.copy());
            }
        }
        else
        {
            copyObj.collObjetparties = null;
        }
        }
        return copyObj;
    }
        
    
    /**
     * Fills the copyObj with the contents of this object using connection.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     * @param con the database connection to read associated objects.
     */
    protected Objet copyInto(Objet copyObj, boolean deepcopy, Connection con) throws TorqueException
    {
        copyObj.setNomobjet(nomobjet);
        copyObj.setDescriptionobjet(descriptionobjet);
        copyObj.setAttaquebonus(attaquebonus);
        copyObj.setDegatsbonus(degatsbonus);
        copyObj.setEsquivebonus(esquivebonus);
        copyObj.setPointdeviebonus(pointdeviebonus);

        copyObj.setNomobjet((String)null);

        if (deepcopy)
        {


        List vEquipements = getEquipements(con);
        if (vEquipements != null)
        {
            for (int i = 0; i < vEquipements.size(); i++)
            {
                Equipement obj = (Equipement) vEquipements.get(i);
                copyObj.addEquipement(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collEquipements = null;
        }


        List vPotions = getPotions(con);
        if (vPotions != null)
        {
            for (int i = 0; i < vPotions.size(); i++)
            {
                Potion obj = (Potion) vPotions.get(i);
                copyObj.addPotion(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collPotions = null;
        }


        List vInventaireequipements = getInventaireequipements(con);
        if (vInventaireequipements != null)
        {
            for (int i = 0; i < vInventaireequipements.size(); i++)
            {
                Inventaireequipement obj = (Inventaireequipement) vInventaireequipements.get(i);
                copyObj.addInventaireequipement(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collInventaireequipements = null;
        }


        List vInventairepotions = getInventairepotions(con);
        if (vInventairepotions != null)
        {
            for (int i = 0; i < vInventairepotions.size(); i++)
            {
                Inventairepotion obj = (Inventairepotion) vInventairepotions.get(i);
                copyObj.addInventairepotion(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collInventairepotions = null;
        }


        List vObjetparties = getObjetparties(con);
        if (vObjetparties != null)
        {
            for (int i = 0; i < vObjetparties.size(); i++)
            {
                Objetpartie obj = (Objetpartie) vObjetparties.get(i);
                copyObj.addObjetpartie(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collObjetparties = null;
        }
        }
        return copyObj;
    }
    
    

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public ObjetPeer getPeer()
    {
        return peer;
    }

    /**
     * Retrieves the TableMap object related to this Table data without
     * compiler warnings of using getPeer().getTableMap().
     *
     * @return The associated TableMap object.
     */
    public TableMap getTableMap() throws TorqueException
    {
        return ObjetPeer.getTableMap();
    }


    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Objet:\n");
        str.append("Nomobjet = ")
           .append(getNomobjet())
           .append("\n");
        str.append("Descriptionobjet = ")
           .append(getDescriptionobjet())
           .append("\n");
        str.append("Attaquebonus = ")
           .append(getAttaquebonus())
           .append("\n");
        str.append("Degatsbonus = ")
           .append(getDegatsbonus())
           .append("\n");
        str.append("Esquivebonus = ")
           .append(getEsquivebonus())
           .append("\n");
        str.append("Pointdeviebonus = ")
           .append(getPointdeviebonus())
           .append("\n");
        return(str.toString());
    }
}
